package com.sam.im.heiqun.uis.adapters.holder;

import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.sam.im.heiqun.R;
import com.sam.im.heiqun.uis.adapters.MessageAdpter;
import com.melink.bqmmsdk.widget.BQMMMessageText;

/**
 * Created by Joe on 2016/12/20.
 */

public class MessageHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
    public final View mView;
    public final ImageView img;
    public final BQMMMessageText content;
    public final TextView nick;
    public final TextView time;
    public final TextView unread_number;
    public final TextView tvaite ;

    public final RelativeLayout relative_allview ;

    private MessageAdpter.MessageListClickListener mMessageListClickListener;

    public MessageHolder(View view, MessageAdpter.MessageListClickListener messageListClickListener) {
        super(view);
        mView = view;
        this.mMessageListClickListener =messageListClickListener;
        img = (ImageView) view.findViewById(R.id.img);
        relative_allview = (RelativeLayout) view.findViewById(R.id.relative_allview);

        content = (BQMMMessageText) view.findViewById(R.id.content);
        nick = (TextView) view.findViewById(R.id.nick);
        time = (TextView) view.findViewById(R.id.time);
        unread_number = (TextView) view.findViewById(R.id.unread_number);
        tvaite = (TextView) view.findViewById(R.id.tv_aite);
        mView.setOnClickListener(this);
        mView.setOnLongClickListener(this);
    }

    @Override
    public void onClick(View v) {
        if (mMessageListClickListener!=null)
        {
            mMessageListClickListener.onMessageListClick(v,getAdapterPosition());
        }
    }

    @Override
    public boolean onLongClick(View v) {
        if (mMessageListClickListener!=null)
        {
            mMessageListClickListener.onMessageLongListClick(v,getAdapterPosition());
        }
        return true;
    }
}